<script type="text/javascript">
//选择事件
function S_NodeCheck(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId),
        nodes = zTree.getCheckedNodes(true)
    var ids = '', names = ''
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id
        names += ','+ nodes[i].name
    }
    if (ids.length > 0) {
        ids = ids.substr(1), names = names.substr(1)
    }
    var $from = $('#'+ treeId).data('fromObj')
    if ($from && $from.length) $from.val(names)
        $('#pid').val(ids);
}
//单击事件
function S_NodeClick(event, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId)
    zTree.checkNode(treeNode, !treeNode.checked, true, true)
    return false
}
console.log($.CurrentDialog);
</script>
<div class="bjui-pageContent">
    <form action="{:U(add)}" class="pageForm" data-toggle="validate">
        <input type="hidden" name="closeCurrent" value="true"  />
        <input type="hidden" name="tabid" value="{$Think.const.CONTROLLER_NAME}"  />
        <input type="hidden"   name="dialogid" value="{$dialogid}"/>
        <table class="table table-condensed table-hover">
            <tbody>
                <tr>
                    <td>
                        <label for="name" class="control-label x90">菜单名称:</label>
                        <input type="text" name="name" id="name" value="" data-rule="required" size="25">
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="url" class="control-label x90">菜单地址:</label>
                        <input type="text" name="url" id="url" value=""  size="25" placeholder="如:Index/index">
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="pid" class="control-label x90">上级分类:</label>
                        <input type="hidden" name="pid" id="pid" value="{$pid}" >
                        <input type="text" name="menus" id="ztree_menus" data-toggle="selectztree" size="25" data-tree="#select_tree" value="{$p_name}" readonly>
                        <ul id="select_tree" class="ztree hide" data-toggle="ztree" data-expand-all="true" data-check-enable="true" data-chk-style="radio" data-radio-type="all" data-on-check="S_NodeCheck" data-on-click="S_NodeClick">
                            <volist name="tree" id="vo">
                            <li data-id="{$vo.id}" data-pid="{$vo.pid}"  data-tabid="{$vo.rel}">{$vo.name}</li>
                            </volist>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="rel" class="control-label x90">菜单ID:</label>
                        <input type="text" name="rel" id="rel" value=""  size="25">
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="target" class="control-label x90">菜单类型:</label>
                        <select name="target" id="target" data-toggle="selectpicker">
                            <option value="dialog">对话框</option>
                            <option value="navtab">导航</option>
                            <option value="doajax">动作</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="sort" class="control-label x90">排序:</label>
                        <input type="text" name="sort" id="sort" value=""  size="25">
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="status" class="control-label x90">状态:</label>
                        <select name="status" id="status" data-toggle="selectpicker">
                            <option value="1">启用</option>
                            <option value="0">禁用</option>
                        </select>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close">关闭</button></li>
        <li><button type="submit" class="btn-default">保存</button></li>
    </ul>
</div>